Skip to content

Fix [p]play for Spotify links with regional codes#6700

Open
Simo62bit wants to merge 1 commit intoCog-Creators:V3/developfrom
Simo62bit:fix/spotify-regional-links
Open

Fix [p]play for Spotify links with regional codes#6700
Simo62bit wants to merge 1 commit intoCog-Creators:V3/developfrom
Simo62bit:fix/spotify-regional-links

Conversation

@Simo62bit
Copy link

@Simo62bit Simo62bit commented Mar 16, 2026

Description of the changes

In audio_dataclasses.py (cogs/audio/apis), modified the Spotify URL regex:

_RE_SPOTIFY_URL: Final[Pattern] = re.compile(r"(http[s]?://)?(open.spotify.com)/")

to:

_RE_SPOTIFY_URL: Final[Pattern] = re.compile(r"(http[s]?://)?(open.spotify.com)/(?:intl-[a-zA-Z-]+/)?")

This ensures that URLs like:

!play https://open.spotify.com/intl-it/track/4KilYheWwxakB1L43ECTeP?si=...

are correctly converted to:

spotify:track:4KilYheWwxakB1L43ECTeP

instead of incorrectly including the regional code (e.g., spotify:intl-it:track:...).

Fixes #6446

Have the changes in this PR been tested?

Yes

In audio_dataclasses.py (cogs/audio/apis), modified the Spotify URL regex:

_RE_SPOTIFY_URL: Final[Pattern] = re.compile(r"(http[s]?://)?(open\.spotify\.com)/")

to:

_RE_SPOTIFY_URL: Final[Pattern] = re.compile(r"(http[s]?://)?(open\.spotify\.com)/(?:intl-[a-zA-Z-]+/)?")

This ensures that URLs like:

!play https://open.spotify.com/intl-it/track/4KilYheWwxakB1L43ECTeP?si=...

are correctly converted to:

spotify:track:4KilYheWwxakB1L43ECTeP

instead of incorrectly including the regional code (e.g., spotify:intl-it:track:...).
@github-actions github-actions bot added the Category: Cogs - Audio This is related to the Audio cog. label Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Cogs - Audio This is related to the Audio cog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[p]play does not accept spotify links with regional codes

1 participant